/********************************************************************
	Rhapsody	: 7.5 
	Login		: kbe
	Component	: DefaultComponent 
	Configuration 	: CodeConfig
	Model Element	: SocketReactorImplementation
//!	Generated Date	: Thu, 13, Sep 2012  
	File Path	: DefaultComponent\CodeConfig\SocketReactorImplementation.cpp
*********************************************************************/

//## auto_generated
#include "SocketReactorImplementation.h"
//## dependency SimulatorReactorImplementation
#include "SimulatorReactorImplementation.h"
//## package Default

//## class SocketReactorImplementation
SocketReactorImplementation::SocketReactorImplementation() {
    //#[ operation SocketReactorImplementation()
    //#]
}

SocketReactorImplementation::~SocketReactorImplementation() {
}

void SocketReactorImplementation::handleEvents(int time) {
    //#[ operation handleEvents(int)
    createHandleList();
    Event_Type eventType;
    HANDLE handle = Select(eventType); 
    EventHandler *eh = getItsEventHandler(handle);
    if (eh != NULL) eh->handleEvent(handle, eventType);
    //#]
}

HANDLE SocketReactorImplementation::Select(Event_Type& type, int timeout) {
    //#[ operation Select(Event_Type,int)
    HANDLE h;
    if (getFirstHandler(h, type)) {
       return h; 
       //while (getNextHandler(h, type)
       //{
       //}
    }
    return 0;
    //type = ACCEPT_EVENT;
    //return 4; // LogAcceptor
    //#]
}

void SocketReactorImplementation::addHandle(HANDLE handle, const Event_Type& type) {
    //#[ operation addHandle(HANDLE,Event_Type)
    printf("addHandle\n");
    //#]
}

// LogAcceptor

/*********************************************************************
	File Path	: DefaultComponent\CodeConfig\SocketReactorImplementation.cpp
*********************************************************************/
